﻿//#version 300 es
uniform sampler2D texture;
uniform vec3 ambientColAttr;
uniform vec3 lightColAttr;
uniform vec3 lightPosAttr;
uniform vec3 viewPosAttr;

varying vec3 col;
varying vec2 v_texcoord;
varying vec3 Normal;
varying vec3 FragPos;

//! [0]
void main()
{
//    //漫反射
//    vec3 norm = normalize(Normal);
//    vec3 lightDir = normalize(lightPosAttr - FragPos);
//    float ambientStrength = 1.0;
//    float diffuse = max(dot(norm, lightDir), 0.0);

//    //高光
//    vec3 viewDir = normalize(viewPosAttr - FragPos);
//    vec3 reflecDir = reflect(-lightDir, norm);
//    float specularStrength = 0.5;
//    float specular = pow(max(dot(viewDir, reflecDir), 0.0), 64) * specularStrength;

//    vec3 color = clamp((diffuse+specular),0.0, 1.0) * col;
    vec3 color = col;
    gl_FragColor = vec4(color, 1.0) * texture2D(texture, v_texcoord);

}
//! [0]
